
package advice.before;

import java.lang.reflect.Method;

import org.springframework.aop.MethodBeforeAdvice;

import com.e885.log.E885Logger;

/**
 * Before Advice 會在目標物件的方法執行之前被呼叫,<br>
 * Aspect 的具體實作稱之為 Advice, 以記錄動作而言, Advice 中會包括日誌記錄程式碼是如何實作的.<br>
 * Advice 中包括了 Cross-cutting concerns 的行為或所要提供的服務.
 * 
 * 
 * @author Eric.Kao(gau168.gau@msa.hinet.net)
 * @version 1.0
 * @company E885 Group
 * @copyright Copyright (c) 2001-2008
 */

public class LogBeforeAdvice implements MethodBeforeAdvice
{
	/*
	 * (non-Javadoc)
	 * 
	 * @see org.springframework.aop.MethodBeforeAdvice#before(java.lang.reflect.Method, java.lang.Object[], java.lang.Object)
	 */
	public void before( Method method, Object[] args, Object target ) throws Throwable
	{
		E885Logger.testLog.debug( "Before Advice 會在目標物件的方法執行之前被呼叫" );
		E885Logger.testLog.debug( "method name:[" + method.getName() + "]" );

		int length = args.length;
		for( int i = 0; i < length; i++ )
			E885Logger.testLog.debug( "arguments[" + i + "]:" + args[ i ] );
	}
}
